-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix Hardware Id hiding when no version detected #2266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Kudos, SonarCloud Quality Gate passed!
|
| </span> | ||
| <br /> | ||
| <span v-if="hardwareId"> | ||
| <span v-if="firmwareVersion && hardwareId"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of a workaround that relies on certain conditions to be true on something unrelated firmwareVersion. As such it is likely to be broken without being detected in the future. It is probably a more maintainable approach to reset hardwareId to be empty at the same place that firmwareVersion is reset on disconnect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will be as easy...
I've looked at the code, and it seems this two FC/MSP variables are being filled by two different MSP commands. The problem is that we have a listener that each time we connect, including when we connect to go to DFU to flash a firmware, we read the hardwareId. The other one is only read when we really "connect" in the Configurator and then we read all the FC info.
With all of this:
- Do we want to add this info to the logo when flashing or only when connected? If we want when flashing too we need to add a listener to onDisconnect or something similar if exists to erase the information.
- If we want only when connected, another option, more descriptive, is to pass a variable to the Vue object indicating if we want to add FC info to the logo, that can be the associated to the variable that contains the info about if we are connected or not.
EDIT: this variable can be GUI.connected_to that contains false if not connected or the port in text form if connected. I don't know if there is other more suitable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @mikeller I'm not satisfied enough with this fix that is based on firmwareVersion, I'll give it one more review to find a better solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I found the time to test this with an actual board only now - since the hardwareId is based on actual information that is returned from the board, I am not sure that it is wrong to show it while flashing the firmware. After that it becomes stale, as there is no way for us to ensure that the same board is connected, especially with the flashing process involving changes between the VCP in serial mode and DFU.
So maybe, instead of hiding this when flashing, we should just make sure that hardwareId is reset at the end of flashing?
Maybe this could be improved optically by moving the Target information above the firmware version information in the top bar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikeller definitelly it happens when dfu autoenable is used in firmware flasher tab, fc reboots in dfu mode and the hardwareId is recognized. If we enable dfu in setup tab al works as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asizon: Yes, this is to be expected. If the flight controller is not in DFU mode already when the flashing is started, we try to 'half-connect' in order to issue the MSP command to reboot the flight controller into DFU mode. This is when the hardware id is read. So keeping this hardware id while the subsequent flashing process is running seems to me to make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asizon: Do you want to change this so that the hardware id is shown during flashing if it is known?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @mikeller im going to look at this, sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason to be sorry - this is a hobby, and everything is voluntary.
|
@mikeller @McGiverGim I am somewhat confused with this and I don't know how to act. Regarding letting it appear in the flashing I think it is incorrect, the hardware Id not be coherent with the flashing target, when the chip erase is finished it should disappear, perhaps directly not appear if it is disconnected. |
|
Putting betaflight-configurator/src/js/protocols/stm32.js Lines 152 to 166 in a8b43e1
|
83ba9bc to
95665de
Compare
|
Thanks for point out this @haslinghuis , moved FC.resetState to stm32.js file. |
Not sure what you mean by this - the hardware id is the id that is stored on the MCU, and is meant to be used as an indicator for users to help them select the correct target to flash. Right now we are not enforcing coherence with the firmware that is flashed, but at some point we might want to use it to warn the user if they try to flash an incorrect target, or even read it when entering the firmware flasher tab and use it to pre-select the correct target. Not sure why you think that not showing correct information is an improvement - to me this is going into the wrong direction. There is one exception: The only way to remove the hardware id is to flash with 'full chip erase' checked, so in this case we might want to suppress the hardware id that is being erased. |
|
But @mikeller ,we have a problem with your suggested aproach, for the moment we can get hardwareId only if the user uses the auto-dfu change pressing flash button, because it not |
|
@asizon: Yes, the display at the moment is only opportunistic. But when it is displayed it is correct, so there is no reason to suppress it. Probably the simplest way to deal with this is to issue |
|
Interesting @mikeller , lets see what can I do. I also think that being able to see the hardwareId (thanks to the reactivity vue, I think), is an improvement. |
|
My thinking too @asizon. |
23b86bd to
883bb9c
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
|
wow this feature sound good @mikeller , now hardwareId is removed when flash finished and check for new devices, lets see if we can some exception when |
|
Looking at this, this seems to be correct the way it is - the hardware target id flashes only quickly when 'Flash' is clicked, as the flight controller reboots into DFU mode immediately, and this is recognised as a disconnect / reconnect. So I think this is correct (but not super helpful) for now, and can be merged. If you are interested to go deeper with this in a next pull request, you could try using the manufacturer / target id stored on the MCU that you get when rebooting into DFU at the beginning of the flashing process, and compare it against the selected target. If they don't match we can then show a dialog with a warning telling the user that the target they are about to flash is different from the target their hardware identifies as, and let them choose if they want to continue or abort. |
After Betaflight logo Vue implementation, HardwareId shows also when fc is flashing. Changed to show only when firmware version is deteced.
Thanks @McGiverGim for point in this lines.